package com.fh.sku.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fh.sku.entity.SkuStock;
import com.fh.sku.service.SkuStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import utils.ResultObj;

import java.util.List;

/**
 * <p>
 * sku的库存 前端控制器
 * </p>
 *
 * @author zs
 * @since 2021-10-12
 */
@RestController
@RequestMapping("/sku")
@CrossOrigin
public class SkuStockController {
    @Autowired
    private SkuStockService skuStockService;
    @GetMapping("{productId}")
    public ResultObj getSkuList(@PathVariable("productId")Long productId){
        QueryWrapper<SkuStock> wrapper=new QueryWrapper<>();
        wrapper.eq("product_id",productId);
        List<SkuStock> list = skuStockService.list(wrapper);
        return ResultObj.success(list);
    }

}
